// 定义reducer 的初始值
const init={
  count: 0,
}

export default function countReducer(prevState=init,action){
  console.log("countReducer调用了",prevState,action)
  
  // 接受action对象 的 type 和 data
  const{
    type,
    data
    }=action;

    switch(type){
      case "increamentCount":return {...init,count:prevState.count+data };
      case "decreamentCount":return {...init,count:prevState.count-data };
    }

  return prevState
}